package com.eaoa.uc.busroute.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.bus.BusRouteQuery;
import com.eaoa.uc.busroute.form.BusRouteCondition;
import com.eaoa.uc.busroute.form.BusRouteSearchForm;

public class BusRouteManageSearchAction extends EABaseAction{

	@Override
	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		
		BusRouteSearchForm sform = (BusRouteSearchForm) form;
		sform.initConditionPost();
		BusRouteCondition condition = (BusRouteCondition) sform.getCondition();
		
		BusRouteQuery query = new BusRouteQuery();
		query.setRoutename(condition.getRoutename());
		query.setRemark(condition.getRemark());
		query.setIslock("N");
		query.setPageRange(sform.getPageinfo());
		query.execute();
		
		request.setAttribute("results", query.getResults());
		
		return mapping.findForward("success");
	}
}
